import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:leader_doctor_flutter/common/http/api.dart';
import 'package:leader_doctor_flutter/common/http/url_helper.dart';

class VerifyCodeExceptionHelpWidget extends StatelessWidget {
  final VoidCallback? onPressed;

  const VerifyCodeExceptionHelpWidget({Key? key, this.onPressed})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Align(
      alignment: Alignment.bottomRight,
      child: GestureDetector(
        onTap: onPressed ??
            () {
              _getCodeExceptionHelp("获取验证码遇到问题？", Api.verifyCodeExceptionHelp);
            },
        child: Text("获取验证码遇到问题？",
            style: TextStyle(fontSize: 14.sp, color: Color(0xFF666666))),
      ),
    );
  }

  /// 获取验证码异常帮助
  _getCodeExceptionHelp(String title, String url) async {
    await UrlHelper.loadH5Page(title, url);
  }
}
